'use strict';

const { Controller } = require('ee-core');
const Services = require('ee-core/services');

/**
 * relationDb
 * @class
 */
class ConnectMngController extends Controller {
    constructor(ctx) {
        super(ctx);
    }


    /**
     * 所有方法接收两个参数
     * @param args 前端传的参数
     * @param event - ipc通信时才有值。详情见：控制器文档
     */

    /**
     * 查询数据库连接列表
     */
    async allConnectList(args,event) {
        return  await Services.get('connectMng').allConnectList();
    }

    /**
     * 新增连接
     */
    async addConnect(args,event) {
        return  await Services.get('connectMng').addConnect(args);
    }

    /**
     * 修改连接
     */
    async editConnect(args,event) {
        return  await Services.get('connectMng').editConnect(args);
    }

    /**
     * 删除连接
     */
    async deleteConnect(args,event) {
        return await Services.get('connectMng').deleteConnect(args);
    }

    /**
     * 克隆连接
     */
    async cloneConnect(args,event) {
        return await Services.get('connectMng').cloneConnect(args);
    }


}

ConnectMngController.toString = () => '[class ConnectMngController]';
module.exports = ConnectMngController;
